-
-
Notifications
You must be signed in to change notification settings - Fork 7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use analogPinToChannel if it's defined #1368
Conversation
This looks like it will break analogRead() on the ATmega32U4 (e.g. the Leonardo) because analogPinToChannel() will be called twice. Can you update (or verify that it's not a problem)? |
Needed in order to work with Arduino Leonardo
Sorry my bad. It should be fixed now. |
Thanks! I don't see any immediate problems. What have you tested it with? |
I havn't had time to test it on any yet. I will try to do it tomorrow or it will be on monday, as I'm off for the weekend. Btw I left these lines untouched: https://github.com/Lauszus/Arduino/blob/59c5b94c51d726ea656471bc232333ebd200eb19/hardware/arduino/cores/arduino/wiring_analog.c#L51-L52, as I didn't want to break any compatibility issues with other devices out there. I don't know if it's really necessary, but I just thought it would be better to stay on the safe side. |
I can confirm it's working on Arduino Mega, Mega2560, Leonardo and Uno. void setup() {
Serial.begin(115200);
}
void loop() {
for(uint8_t i = 0; i < NUM_ANALOG_INPUTS; i++) {
Serial.print(analogRead(A0+i));
Serial.print('\t');
delay(100);
}
Serial.println();
} |
@damellis Have you had time to try it yet? |
@damellis Any news regarding this issue? |
Merged, thank you! |
See #1366